/*     */ package com.qmsk.business.informake.infoMake.controller;
/*     */ 
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.http.HttpGsonPtResponseUtils;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"ptInfoMake"})
/*     */ public class InfoMakeController
/*     */ {
/*  25 */   private static final Logger logger = Logger.getLogger(InfoMakeController.class);
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/opt/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  42 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  44 */       String sUrl = "ptInfoMake/find/shopId/" + shopId + "/opt/" + 
/*  45 */         nPageIdx + "/" + nPageSize;
/*  46 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl + "?" + 
/*  47 */         RequestUtils.getUtf8ParamsOfRequest(request), response);
/*  48 */       if ((rst != null) && (rst.getState() == 0)) {
/*  49 */         ResponseUtils.setResponseResult(rst, response);
/*  50 */         return; }
/*  51 */       ResponseUtils.setSqlResultResponse(0, 
/*  52 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  53 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  56 */       logger.error(e);
/*  57 */       ResponseUtils.setErrorMsgResponse(
/*  58 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListId(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id, @PathVariable("shopId") Long shopId)
/*     */   {
/*     */     try
/*     */     {
/*  67 */       String sData = "";
/*  68 */       String sUrl = "ptInfoMake/find/shopId/" + shopId + "/id/" + id;
/*  69 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl, sData, 
/*  70 */         response);
/*  71 */       if ((rst != null) && (rst.getState() == 0)) {
/*  72 */         ResponseUtils.setResponseResult(rst, response);
/*  73 */         return; }
/*  74 */       ResponseUtils.setSqlResultResponse(0, 
/*  75 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  76 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  79 */       logger.error(e);
/*  80 */       ResponseUtils.setErrorMsgResponse(
/*  81 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert/shopId/{shopId}/{id}/{sendRange}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*     */     try
/*     */     {
/* 104 */       String sData = RequestUtils.getParamsOfRequest(request, false);
/* 105 */       String sUrl = "ptInfoMake/insert/shopId/" + shopId;
/* 106 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 107 */         response);
/* 108 */       if ((rst != null) && (rst.getState() == 0)) {
/* 109 */         ResponseUtils.setResponseResult(rst, response);
/* 110 */         return; }
/* 111 */       ResponseUtils.setSqlResultResponse(0, 
/* 112 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 113 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 116 */       logger.error(e);
/* 117 */       ResponseUtils.setErrorMsgResponse(
/* 118 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 119 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit/shopId/{shopId}/{id}/{sendRange}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("id") Long id, @PathVariable("sendRange") Integer sendRange)
/*     */   {
/* 139 */     String sGsonInData = RequestUtils.getString(request, "data");
/*     */     try
/*     */     {
/* 157 */       String sData = "data=" + sGsonInData + "&id=" + id;
/* 158 */       String sUrl = "ptInfoMake/edit/shopId/" + shopId + "/" + 
/* 159 */         String.valueOf(id) + "/" + String.valueOf(sendRange);
/* 160 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 161 */         response);
/* 162 */       if ((rst != null) && (rst.getState() == 0)) {
/* 163 */         ResponseUtils.setResponseResult(rst, response);
/* 164 */         return; }
/* 165 */       ResponseUtils.setSqlResultResponse(0, 
/* 166 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 167 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 170 */       logger.error(e);
/* 171 */       ResponseUtils.setErrorMsgResponse(
/* 172 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 173 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/sentInfo/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOpt2ShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 183 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 185 */       String sData = "";
/* 186 */       String sUrl = "ptInfoMake/find/shopId/" + shopId + "/sentInfo/" + nPageIdx + "/" + nPageSize;
/* 187 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl + "?" + 
/* 188 */         RequestUtils.getUtf8ParamsOfRequest(request), sData, response);
/* 189 */       if ((rst != null) && (rst.getState() == 0)) {
/* 190 */         ResponseUtils.setResponseResult(rst, response);
/* 191 */         return; }
/* 192 */       ResponseUtils.setSqlResultResponse(0, 
/* 193 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 194 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 197 */       logger.error(e);
/* 198 */       ResponseUtils.setErrorMsgResponse(
/* 199 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/resTotal/{infoId}/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getStatistics(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("infoId") String infoId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 210 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/* 211 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 213 */       String sData = "id=" + id;
/* 214 */       String sUrl = "ptInfoMake/find/shopId/" + shopId + "/resTotal/" + infoId + "/" + nPageIdx + "/" + nPageSize;
/* 215 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl, sData, 
/* 216 */         response);
/* 217 */       if ((rst != null) && (rst.getState() == 0)) {
/* 218 */         ResponseUtils.setResponseResult(rst, response);
/* 219 */         return; }
/* 220 */       ResponseUtils.setSqlResultResponse(0, 
/* 221 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 222 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 225 */       logger.error(e);
/* 226 */       ResponseUtils.setErrorMsgResponse(
/* 227 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 244 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 246 */       String sData = "id=" + id;
/* 247 */       String sUrl = "ptInfoMake/del/shopId/" + shopId;
/* 248 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 249 */         response);
/* 250 */       if ((rst != null) && (rst.getState() == 0)) {
/* 251 */         ResponseUtils.setResponseResult(rst, response);
/* 252 */         return; }
/* 253 */       ResponseUtils.setSqlResultResponse(0, 
/* 254 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 255 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 258 */       logger.error(e);
/* 259 */       ResponseUtils.setErrorMsgResponse(
/* 260 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 261 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"check/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void check(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */     throws SQLException
/*     */   {
/*     */     try
/*     */     {
/* 281 */       String sData = RequestUtils.getUtf8ParamsOfRequest(request);
/* 282 */       String sUrl = "ptInfoMake/check/shopId/" + shopId;
/* 283 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 284 */         response);
/* 285 */       if ((rst != null) && (rst.getState() == 0)) {
/* 286 */         ResponseUtils.setResponseResult(rst, response);
/* 287 */         return; }
/* 288 */       ResponseUtils.setSqlResultResponse(0, 
/* 289 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 290 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 293 */       logger.error(e);
/* 294 */       ResponseUtils.setErrorMsgResponse(
/* 295 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 296 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.informake.infoMake.controller.InfoMakeController
 * JD-Core Version:    0.5.3
 */